package org.security
class Resource {
	int priority = 0
	String url
	String configAttribute
	
	String displayName
	String type
	String remark
	Resource parent

	static belongsTo =[Role]
	static hasMany = [roles:Role]
	static constraints = {
		priority(blank:true)
		url blank: false, unique: true
		type(blank:false,inList:["MENU","URL"])
		configAttribute blank: false
		displayName(blank:false)
		remark(widget:'textarea',blank:true)
	}
	static mapping={
		cache true
		sort "priority"
		 order "asc"
	}
	String toString(){
		render "${displayName}"	
	}
	
}
